import * as actionTypes from './constant';
import { getRentalInfo, handleRentalExamin } from '../../services';
import { message } from 'antd';


const changeRentalInfo = (res) => ({
    type:actionTypes.CHANGE_RENTAL_INFO,
    rentalInfo: res.data
})

export const getRentalInfoAction = () => {
    return dispatch => {
        getRentalInfo().then(res => {
            // console.log(res);
            dispatch(changeRentalInfo(res));
        })
    }
}

export const handleRentalExaminAction = (examinInfo) => {
    return dispatch => {
        handleRentalExamin(examinInfo).then(res => {
            // console.log(res);
            if(res.status == 200)
            {
                message.success(res.message)
            }
        })
    }
}